package com.bailian.spring.ioc.basic_dl.dl_name;

import com.bailian.spring.ioc.basic_dl.dl_name.bean.Person;
import com.bailian.spring.ioc.basic_dl.dl_name.dao.DemoDao;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author gaoxu
 * date: Created on 2021/10/28 下午4:17
 */
public class QuickstartByTypeApplication {

    public static void main(String[] args) throws Exception {
        BeanFactory beanFactory = new ClassPathXmlApplicationContext("basic_dl/quickstart-bytype.xml");
        // 1.根据类获取
        Person person = beanFactory.getBean(Person.class);
        System.out.println(person);

        // 2.根据接口获取
        DemoDao demoDao = beanFactory.getBean(DemoDao.class);
        System.out.println(demoDao.findAll());
    }
}
